//
//  UIApplication+AP.swift
//  APExtensions
//
//  Created by jianbo.pei on 2023/11/23.
//

import UIKit

public extension UIApplication {
    @available(iOS 13.0, *)
    public class var keyWindow: UIWindow? {
        UIApplication.shared.connectedScenes
            .filter { $0.activationState == .foregroundActive }
            .compactMap { $0 as? UIWindowScene }.first?.windows
            .filter { $0.isKeyWindow }.first
    }
}
